package com.forest.sdk.example.controller;

import com.forest.dto.ResultResponse;
import com.forest.sdk.example.service.SdkTestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/sdk")
@Api(tags = "sdk测试", value = "SdkTestController")
public class SdkTestController {

    @Resource
    private SdkTestService sdkTestService;



    @GetMapping("/sm4EncryptBase64")
    @ApiOperation(value = "加密-sm4-base64")
    public ResultResponse<String> sm4EncryptBase64(@RequestParam String data) {
        return ResultResponse.success(sdkTestService.sm4EncryptBase64(data));
    }

    @GetMapping("/sm4EncryptHex")
    @ApiOperation(value = "加密-sm4-hex")
    public ResultResponse<String> sm4EncryptHex(@RequestParam String data) {
        return ResultResponse.success(sdkTestService.sm4EncryptHex(data));
    }

    @GetMapping("/sm4Decrypt")
    @ApiOperation(value = "解密-sm4")
    public ResultResponse<String> sm4Decrypt(@RequestParam String data) {
        return ResultResponse.success(sdkTestService.sm4Decrypt(data));
    }

    @GetMapping("/aesEncryptBase64")
    @ApiOperation(value = "加密-aes-base64")
    public ResultResponse<String> aesEncryptBase64(@RequestParam String data) {
        return ResultResponse.success(sdkTestService.aesEncryptBase64(data));
    }

    @GetMapping("/aesEncryptHex")
    @ApiOperation(value = "加密-aes-hex")
    public ResultResponse<String> aesEncryptHex(@RequestParam String data) {
        return ResultResponse.success(sdkTestService.aesEncryptHex(data));
    }

    @GetMapping("/aesDecrypt")
    @ApiOperation(value = "解密-aes")
    public ResultResponse<String> aesDecrypt(@RequestParam String data) {
        return ResultResponse.success(sdkTestService.aesDecrypt(data));
    }

    @GetMapping("/signatureHttpUtilPost")
    @ApiOperation(value = "http工具-post请求")
    public ResultResponse signatureHttpUtilPost() {
        return ResultResponse.success(sdkTestService.signatureHttpUtilPost());
    }

    @GetMapping("/signatureHttpUtilGet")
    @ApiOperation(value = "http工具-get请求")
    public ResultResponse signatureHttpUtilGet() {
        return ResultResponse.success(sdkTestService.signatureHttpUtilGet());
    }

    @GetMapping("/signatureHttpUtilPostForEncryption")
    @ApiOperation(value = "http工具-参数加密")
    public ResultResponse signatureHttpUtilPostForEncryption() {
        return ResultResponse.success(sdkTestService.signatureHttpUtilPostForEncryption());
    }
}
